const $Toast = {
	none: (str, time = 1500) => {
		return new Promise((resolve, reject) => {
			uni.showToast({
				title: str,
				icon: "none",
				duration: time,
				success: () => {
					setTimeout(() => {
						resolve()
					}, time)
				}
			})
		})
	},
	success: (str, time = 1500) => {
		return new Promise((resolve, reject) => {
			uni.showToast({
				title: str,
				icon: "success",
				duration: time,
				success: () => {
					setTimeout(() => {
						resolve()
					}, time)
				}
			})
		})
	},
	loading: (str) => {
		return new Promise((resolve, reject) => {
			uni.showLoading({
				title: str,
				icon: "loading",
				success: () => {
					resolve();
				}
			})
		})
	},
	error: (str, time = 1500) => {
		return new Promise((resolve, reject) => {
			uni.showToast({
				title: str,
				icon: "error",
				duration: time,
				success: () => {
					setTimeout(() => {
						resolve()
					}, time)
				}
			})
		})
	},
}

export {
	$Toast
}
